import HttpRequest from "@/lib/axios.js";

class GoodsModel extends HttpRequest {
  constructor() {
    super();
  }
  /* 获取商品规格列表 */
  _getGoodsList() {
    return this.req({
      url: "goods/getGoodsList",
      method: "post"
    });
  }
  /* 我要补货接口 */
  _createSupplementOrder({
    type,
    count,
    receiver_name,
    receiver_mobile,
    receiver_address,
    area_name
  }) {
    return this.req({
      url: "order/createSupplementOrder",
      method: "post",
      data: {
        type,
        count,
        receiver_name,
        receiver_mobile,
        receiver_address,
        area_name
      }
    });
  }
  /* 获取我的订单列表 */
  _getMyOrderList({ curpage = 0, pagesize = 9999, status }) {
    return this.req({
      url: "order/getMyOrderList",
      method: "post",
      data: {
        curpage,
        pagesize,
        status
      }
    });
  }
  /* 订单支付 */
  _pay({ order_sn, payment, pay_number }) {
    return this.req({
      url: "order/pay",
      method: "post",
      data: {
        order_sn,
        payment,
        pay_number
      }
    });
  }
  _getGoodsPrice() {
    return this.req({
      url: "goods/getGoodsPrice"
    });
  }
}

export default GoodsModel;
